import Vue from "vue";
import locale from "element-ui/lib/locale";
import VueI18n from "vue-i18n";
import messages from "./langs";

Vue.use(VueI18n);
let lang = navigator.language||navigator.userLanguage;//常规浏览器语言和IE浏览器
lang = lang.substr(0, 2);//截取lang前2位字符
const i18n = new VueI18n({
  locale: lang == "zh" ? "en" : "en",
  messages,
  // silentTranslationWarn: true,//没有的key值不发出警告
});
// console.log(lang,'王')
// console.log(i18n,88)
locale.i18n((key, value) => i18n.t(key, value));

export default i18n;
